From b0786556d3fda06613a2bb42e75d8221231ab479 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 13 Feb 2009 09:48:56 +0000 Subject: [PATCH] x86: Clean up vpt-align patch. Also disable by default if not specified in domain config. Otherwise the feature would be incorrectly enabled for old saved domain images. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hvm.c | 1 - xen/arch/x86/hvm/vpt.c | 16 +++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 517dbb33e8..ae4acb3787 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -311,7 +311,6 @@ int hvm_domain_initialise(struct domain *d) hvm_init_guest_time(d); d->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] = 1; - d->arch.hvm_domain.params[HVM_PARAM_VPT_ALIGN] = 1; hvm_init_cacheattr_region_list(d); diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 33f2400a0e..fe4ec99129 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -384,17 +384,23 @@ void create_periodic_time( pt->period_cycles = (u64)period; pt->one_shot = !period; pt->scheduled = NOW() + delta; - /* - * Offset LAPIC ticks from other timer ticks. Otherwise guests which use - * LAPIC ticks for process accounting can see long sequences of process - * ticks incorrectly accounted to interrupt processing. - */ + if ( !pt->one_shot ) { if ( v->domain->arch.hvm_domain.params[HVM_PARAM_VPT_ALIGN] ) + { pt->scheduled = align_timer(pt->scheduled, pt->period); + } else if ( pt->source == PTSRC_lapic ) + { + /* + * Offset LAPIC ticks from other timer ticks. Otherwise guests + * which use LAPIC ticks for process accounting can see long + * sequences of process ticks incorrectly accounted to interrupt + * processing (seen with RHEL3 guest). + */ pt->scheduled += delta >> 1; + } } pt->cb = cb; -- 2.30.2